﻿namespace Digitalmes.Application.Sys.Posts.Commands;

/// <summary>
/// 删除职位命令。
/// </summary>
public record DeletePosCommand(long Id) : IRequest<IResult<bool>>;

internal sealed class DeletePosCommandHandler(IRepository<SysPos> repo) : IRequestHandler<DeletePosCommand, IResult<bool>>
{
    public async Task<IResult<bool>> Handle(DeletePosCommand request, CancellationToken cancellationToken)
    {
        var ok = await repo.DeleteByIdAsync(request.Id, cancellationToken);
        return Result.From(ok);
    }
}
